Location: SLC transporters @ 4c70c12474d3 / Electrogenic cotransporter / CellMLV2 / SGLT1_BG.py

Author:
Weiwei Ai <wai484@aucklanduni.ac.nz>
Date:
2024-05-08 11:31:07+12:00
Desc:
Add sedml and scripts for SGLT1
Permanent Source URI:
https://models.physiomeproject.org/workspace/b65/rawfile/4c70c12474d3ae6c1f083145619576bfaf426439/Electrogenic cotransporter/CellMLV2/SGLT1_BG.py

# The content of this file was generated using the Python profile of libCellML 0.5.0.

from enum import Enum
from math import *


__version__ = "0.4.0"
LIBCELLML_VERSION = "0.5.0"

STATE_COUNT = 6
VARIABLE_COUNT = 99


class VariableType(Enum):
    VARIABLE_OF_INTEGRATION = 0
    STATE = 1
    CONSTANT = 2
    COMPUTED_CONSTANT = 3
    ALGEBRAIC = 4


VOI_INFO = {"name": "t", "units": "second", "component": "params_BG", "type": VariableType.VARIABLE_OF_INTEGRATION}

STATE_INFO = [
    {"name": "q_1", "units": "fmol", "component": "SGLT1_BG", "type": VariableType.STATE},
    {"name": "q_2", "units": "fmol", "component": "SGLT1_BG", "type": VariableType.STATE},
    {"name": "q_3", "units": "fmol", "component": "SGLT1_BG", "type": VariableType.STATE},
    {"name": "q_4", "units": "fmol", "component": "SGLT1_BG", "type": VariableType.STATE},
    {"name": "q_5", "units": "fmol", "component": "SGLT1_BG", "type": VariableType.STATE},
    {"name": "q_6", "units": "fmol", "component": "SGLT1_BG", "type": VariableType.STATE}
]

VARIABLE_INFO = [
    {"name": "V0_Vm", "units": "volt", "component": "params_BG", "type": VariableType.ALGEBRAIC},
    {"name": "V_E", "units": "volt", "component": "params_BG", "type": VariableType.ALGEBRAIC},
    {"name": "q_Nai", "units": "fmol", "component": "params_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "Nai", "units": "mM", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "V_i", "units": "pL", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_Nao", "units": "fmol", "component": "params_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "Nao", "units": "mM", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "V_o", "units": "pL", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_Glci", "units": "fmol", "component": "params_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "Glci", "units": "mM", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_Glco", "units": "fmol", "component": "params_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "Glco", "units": "mM", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "test_volt", "units": "volt", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "R", "units": "J_per_K_mol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "T", "units": "kelvin", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "F", "units": "C_per_mol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_Nai", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_Nao", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_Glci", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_Glco", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_1", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_1", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_2", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_2", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_3", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_3", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_4", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_4", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_5", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_5", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "K_6", "units": "per_fmol_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "q_init_6", "units": "fmol", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "z_zf1", "units": "dimensionless", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "z_zr1", "units": "dimensionless", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "z_zf6", "units": "dimensionless", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "z_zr6", "units": "dimensionless", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r1", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r2", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r3", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r4", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r5", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r6", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "kappa_r7", "units": "fmol_per_s_1", "component": "params_BG", "type": VariableType.CONSTANT},
    {"name": "I_ss", "units": "fA", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r6", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "Ii", "units": "fA", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "I_zf1", "units": "fA", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "I_zr6", "units": "fA", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "I_zf6", "units": "fA", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "I_zr1", "units": "fA", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_Nai", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "mu_Nao", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "mu_Glci", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "mu_Glco", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.COMPUTED_CONSTANT},
    {"name": "mu_1", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_1", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_2", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_2", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_3", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_3", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_4", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_4", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_5", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_5", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_6", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_6", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "V_Vm", "units": "volt", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_zf1", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "V_zf1", "units": "volt", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_zf1", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_zr1", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "V_zr1", "units": "volt", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_zr1", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_zf6", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "V_zf6", "units": "volt", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_zf6", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "mu_zr6", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "V_zr6", "units": "volt", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_zr6", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r1", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r1", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r1", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r2", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r2", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r2", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r3", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r3", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r3", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r4", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r4", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r4", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r5", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r5", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r5", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r6", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r6", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "v_r7", "units": "fmol_per_s", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_f_r7", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC},
    {"name": "A_r_r7", "units": "J_per_mol", "component": "SGLT1_BG", "type": VariableType.ALGEBRAIC}
]


def lt_func(x, y):
    return 1.0 if x < y else 0.0


def create_states_array():
    return [nan]*STATE_COUNT


def create_variables_array():
    return [nan]*VARIABLE_COUNT


def initialise_variables(states, rates, variables):
    variables[3] = 20.0
    variables[4] = 8.5e5
    variables[6] = 100.0
    variables[7] = 8.5e5
    variables[9] = 10.0e-3
    variables[11] = 1.0e-12
    variables[12] = 0.0
    variables[13] = 8.31
    variables[14] = 293.0
    variables[15] = 96485.0
    variables[16] = 3.216e-08
    variables[17] = 3.216e-08
    variables[18] = 4.848e-06
    variables[19] = 4.848e-06
    variables[20] = 2.235
    variables[21] = 16.605778811026234
    variables[22] = 10.437
    variables[23] = 16.605778811026234
    variables[24] = 8.602
    variables[25] = 16.605778811026234
    variables[26] = 8.602
    variables[27] = 16.605778811026234
    variables[28] = 28.628
    variables[29] = 16.605778811026234
    variables[30] = 0.192
    variables[31] = 16.605778811026234
    variables[32] = 0.3
    variables[33] = 0.3
    variables[34] = 0.7
    variables[35] = 0.7
    variables[36] = 47.905
    variables[37] = 2.325
    variables[38] = 5.812
    variables[39] = 92.998
    variables[40] = 0.349
    variables[41] = 15.661
    variables[42] = 0.029
    states[0] = variables[21]
    states[1] = variables[23]
    states[2] = variables[25]
    states[3] = variables[27]
    states[4] = variables[29]
    states[5] = variables[31]


def compute_computed_constants(variables):
    variables[2] = variables[3]*variables[4]
    variables[5] = variables[6]*variables[7]
    variables[8] = variables[9]*variables[4]
    variables[10] = variables[11]*variables[7]
    variables[50] = variables[13]*variables[14]*log(variables[16]*variables[2])
    variables[51] = variables[13]*variables[14]*log(variables[17]*variables[5])
    variables[52] = variables[13]*variables[14]*log(variables[18]*variables[8])
    variables[53] = variables[13]*variables[14]*log(variables[19]*variables[10])


def compute_rates(voi, states, rates, variables):
    variables[54] = variables[13]*variables[14]*log(variables[20]*states[0])
    variables[1] = -0.05 if lt_func(voi, 1204.75e-3) else variables[12] if lt_func(voi, 2984.75e-3) else -0.05
    variables[0] = variables[1]
    variables[66] = variables[0]
    variables[68] = variables[66]
    variables[67] = variables[32]*variables[15]*variables[68]
    variables[80] = 2.0*variables[51]+variables[54]-variables[67]
    variables[56] = variables[13]*variables[14]*log(variables[22]*states[1])
    variables[71] = variables[66]
    variables[70] = variables[33]*variables[15]*variables[71]
    variables[81] = variables[56]+variables[70]
    variables[79] = variables[36]*(exp(variables[80]/(variables[13]*variables[14]))-exp(variables[81]/(variables[13]*variables[14])))
    variables[64] = variables[13]*variables[14]*log(variables[30]*states[5])
    variables[74] = variables[66]
    variables[73] = variables[34]*variables[15]*variables[74]
    variables[94] = variables[64]-variables[73]
    variables[77] = variables[66]
    variables[76] = variables[35]*variables[15]*variables[77]
    variables[95] = variables[54]+variables[76]
    variables[44] = variables[41]*(exp(variables[94]/(variables[13]*variables[14]))-exp(variables[95]/(variables[13]*variables[14])))
    variables[55] = -variables[79]+variables[44]
    rates[0] = variables[55]
    variables[83] = variables[53]+variables[56]
    variables[58] = variables[13]*variables[14]*log(variables[24]*states[2])
    variables[84] = variables[58]
    variables[82] = variables[37]*(exp(variables[83]/(variables[13]*variables[14]))-exp(variables[84]/(variables[13]*variables[14])))
    variables[97] = variables[56]
    variables[62] = variables[13]*variables[14]*log(variables[28]*states[4])
    variables[98] = variables[62]
    variables[96] = variables[42]*(exp(variables[97]/(variables[13]*variables[14]))-exp(variables[98]/(variables[13]*variables[14])))
    variables[57] = variables[79]-variables[82]-variables[96]
    rates[1] = variables[57]
    variables[86] = variables[58]
    variables[60] = variables[13]*variables[14]*log(variables[26]*states[3])
    variables[87] = variables[60]
    variables[85] = variables[38]*(exp(variables[86]/(variables[13]*variables[14]))-exp(variables[87]/(variables[13]*variables[14])))
    variables[59] = variables[82]-variables[85]
    rates[2] = variables[59]
    variables[89] = variables[60]
    variables[90] = variables[52]+variables[62]
    variables[88] = variables[39]*(exp(variables[89]/(variables[13]*variables[14]))-exp(variables[90]/(variables[13]*variables[14])))
    variables[61] = variables[85]-variables[88]
    rates[3] = variables[61]
    variables[92] = variables[62]
    variables[93] = 2.0*variables[50]+variables[64]
    variables[91] = variables[40]*(exp(variables[92]/(variables[13]*variables[14]))-exp(variables[93]/(variables[13]*variables[14])))
    variables[63] = variables[88]-variables[91]+variables[96]
    rates[4] = variables[63]
    variables[65] = variables[91]-variables[44]
    rates[5] = variables[65]


def compute_variables(voi, states, rates, variables):
    variables[64] = variables[13]*variables[14]*log(variables[30]*states[5])
    variables[94] = variables[64]-variables[73]
    variables[54] = variables[13]*variables[14]*log(variables[20]*states[0])
    variables[95] = variables[54]+variables[76]
    variables[44] = variables[41]*(exp(variables[94]/(variables[13]*variables[14]))-exp(variables[95]/(variables[13]*variables[14])))
    variables[43] = 2.0*variables[15]*-variables[44]
    variables[80] = 2.0*variables[51]+variables[54]-variables[67]
    variables[56] = variables[13]*variables[14]*log(variables[22]*states[1])
    variables[81] = variables[56]+variables[70]
    variables[79] = variables[36]*(exp(variables[80]/(variables[13]*variables[14]))-exp(variables[81]/(variables[13]*variables[14])))
    variables[69] = variables[79]
    variables[46] = variables[32]*variables[15]*variables[69]
    variables[78] = variables[44]
    variables[47] = variables[35]*variables[15]*variables[78]
    variables[75] = variables[44]
    variables[48] = variables[34]*variables[15]*variables[75]
    variables[72] = variables[79]
    variables[49] = variables[33]*variables[15]*variables[72]
    variables[45] = variables[46]+variables[49]+variables[48]+variables[47]
    variables[58] = variables[13]*variables[14]*log(variables[24]*states[2])
    variables[60] = variables[13]*variables[14]*log(variables[26]*states[3])
    variables[62] = variables[13]*variables[14]*log(variables[28]*states[4])
    variables[83] = variables[53]+variables[56]
    variables[84] = variables[58]
    variables[82] = variables[37]*(exp(variables[83]/(variables[13]*variables[14]))-exp(variables[84]/(variables[13]*variables[14])))
    variables[86] = variables[58]
    variables[87] = variables[60]
    variables[85] = variables[38]*(exp(variables[86]/(variables[13]*variables[14]))-exp(variables[87]/(variables[13]*variables[14])))
    variables[89] = variables[60]
    variables[90] = variables[52]+variables[62]
    variables[88] = variables[39]*(exp(variables[89]/(variables[13]*variables[14]))-exp(variables[90]/(variables[13]*variables[14])))
    variables[92] = variables[62]
    variables[93] = 2.0*variables[50]+variables[64]
    variables[91] = variables[40]*(exp(variables[92]/(variables[13]*variables[14]))-exp(variables[93]/(variables[13]*variables[14])))
    variables[97] = variables[56]
    variables[98] = variables[62]
    variables[96] = variables[42]*(exp(variables[97]/(variables[13]*variables[14]))-exp(variables[98]/(variables[13]*variables[14])))
    variables[55] = -variables[79]+variables[44]
    variables[57] = variables[79]-variables[82]-variables[96]
    variables[59] = variables[82]-variables[85]
    variables[61] = variables[85]-variables[88]
    variables[63] = variables[88]-variables[91]+variables[96]
    variables[65] = variables[91]-variables[44]